<script setup lang="ts">
// 1:下载插件  yarn add socket.io-client
// 2:导入
import { io } from 'socket.io-client'
// 3:连接服务器
const socket = io('ws://119.91.150.211:1235')
socket.on('connect', () => {
  console.log('连接成功')
})
// 4:接收信息  默认：message，后端可以调整
socket.on('message', msg => {
  console.log(msg)
})
// 5:我们发送信息到服务器
socket.emit('message', 'hello')
</script>

<template>
  <div class="app-page">
    <van-button @click="socket.close()">关闭</van-button>
  </div>
</template>

<style lang="scss" scoped></style>
